Skip to content

fix(proxy): SOCKS split message parsing fix - #308

Merged
seanmonstar merged 3 commits into
hyperium:masterfrom
JPDye:socks5-split-message-parsing-fix
Jul 31, 2026
Merged

fix(proxy): SOCKS split message parsing fix#308
seanmonstar merged 3 commits into
hyperium:masterfrom
JPDye:socks5-split-message-parsing-fix

Conversation

@JPDye

@JPDye JPDye commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

closes hyperium/hyper#4127

Messages that arrived in two read calls were not parsed properly due to the bytes being consumed. Now using a view into the buffer and only advancing upon receiving a complete message.

Also fixed an Address parsing bug and wrote tests for (de)serializing messages.

JPDye added 3 commits July 31, 2026 11:48
- test for "incomplete" message parsing
- test for Address::Domain parsing bug
- incomplete message tests fixed by parsing through a view
- domain parsing fixed by consuming domain length

@seanmonstar seanmonstar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@seanmonstar
seanmonstar merged commit 6b451a1 into hyperium:master Jul 31, 2026
18 checks passed
monosans added a commit to monosans/hyper-util that referenced this pull request Aug 1, 2026
… NULL

Merging master brought in the `v4::messages` unit tests added by hyperium#308.
They encode the pre-fix 10-byte request -- an empty USERID byte followed
by a separate NULL -- so with the extra byte removed on this branch both
`request_serialization_with_socket` and `request_serialization_with_domain`
asserted the old expectation and failed.

Drop the duplicated NULL from both expected buffers.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hyper-util SOCKS5: "failed parsing server response" when the CONNECT reply arrives in multiple TCP segments (partial parse consumes the buffer)

2 participants